refer to ..\Other WIPs\oddities.txt for info on bond folder selection

loads (1st time) to 8016C7D0
0x0	050004E4	8016CCB4	//handle for tabs on side of folder
0x4	05000514	8016CCE4	//handle for basic folder
0x8	050005D4	8016CDA4	//handle for FOR YOUR EYES ONLY
0xC	05000604	8016CDD4	//handle for OHMSS
0x10	05000634	8016CE04	//handle for CONFIDENTIAL - briefing
0x14	05000664	8016CE34	//handle for CONFIDENTIAL - multi
0x18	05000694	8016CE64	//handle for CLASSIFIED
0x1C	050006C4	8016CE94	//handle to shadow beneath character image
0x20	050006F4	8016CEC4	//handle for 1st selected file image (Connery)
0x24	05000724	8016CEF4	//handle for 2st selected file image (Dalton)
0x28	05000754	8016CF24	//handle for 3st selected file image (Moore)
0x2C	05000784	8016CF54	//handle for 4st selected file image (Brosnan)
0x30	050007CC	8016CF9C	//handle to shadow beneath briefing image
0x34	05000BD4	8016D3A4	//handle to main folder select screen
0x38	05000C04	8016D3D4	//handle to shadow beneath slot selection pic
0x3C	05000C34	8016D404	//handle for 1st slot selection pic (Connery)
0x40	05000C64	8016D434	//handle for 2st slot selection pic (Dalton)
0x44	05000C94	8016D464	//handle for 3st slot selection pic (Moore)
0x48	05000CC4	8016D494	//handle for 4st slot selection pic (Brosnan)
0x4C	05000574	8016CD44	//handle for solo stage select
0x50	050005A4	8016CD74	//handle to solo selection table (stage imgs)
0x54	050005BC	8016CD8C	//solo selection table (stage imgs)
0x58	050007FC	8016CFCC	//handle for Dam briefing image
0x5C	0500082C	8016CFFC	//handle for Facility briefing image
0x60	0500085C	8016D02C	//handle for Runway briefing image
0x64	0500088C	8016D05C	//handle for Surface I briefing image
0x68	050008BC	8016D08C	//handle for Bunker I briefing image
0x6C	050008EC	8016D0BC	//handle for Silo briefing image
0x70	0500091C	8016D0EC	//handle for Frigate briefing image
0x74	0500094C	8016D11C	//handle for Surface II briefing image
0x78	0500097C	8016D14C	//handle for Bunker II briefing image
0x7C	050009AC	8016D17C	//handle for Statue briefing image
0x80	050009DC	8016D1AC	//handle for Archives briefing image
0x84	05000A0C	8016D1DC	//handle for Streets briefing image
0x88	05000A3C	8016D20C	//handle for Depot briefing image
0x8C	05000A6C	8016D23C	//handle for Train briefing image
0x90	05000A9C	8016D26C	//handle for Jungle briefing image
0x94	05000ACC	8016D29C	//handle for Control briefing image
0x98	05000AFC	8016D2CC	//handle for Caverns briefing image
0x9C	05000B2C	8016D2FC	//handle for Cradle briefing image
0xA0	05000B5C	8016D32C	//handle for Aztec briefing image
0xA4	05000B8C	8016D35C	//handle for Egypt briefing image
0xA8	05000544	8016CD14	//handle to secondary folder (multi, cheats, briefings)

images are modded, but need to use the other three files!

character fix:
TLB-ram 	rom(E)	rom(J)	rom(P)	edit!
7F00D349	41E79	41ED9	3FC39	92
7F00B824	40354	403B4	3E114	2A460004
7F00B834	40364	403C4	3E124	2A460003
7F00B844	40374	403D4	3E134	2A460002
7F00B854	40384	403E4	3E144	2A460001

corrects main menu:
7F00B864	40394	403F4	3E154	2A460004
7F00B874	403A4	40404	3E164	2A460003
7F00B884	403B4	40414	3E174	2A460002
7F00B894	403C4	40424	3E184	2A460001

then the binary...


-------------------
object list instance entries: 8023C320	0xBC in size
0x0	4	0000008C	unknown...
0x4	4	00000000
0x8	4	80039890	handle to object header
0xC	4	800B91E0	not certain...
0x10	4	8023CAA0	more crazy data
rest are floats

---------ASM
7001385C:	COPY ROUTINE FROM COMPRESSION PROBABLY
LBU	T6,0000 (V1)	//T6<-8016C7F0
ADDIU	A2,A2,FFFF	//starts out at 4, dec
ADDIU	V0,V0,0001
ADDIU	V1,V1,0001
BNEZ	A2,7001385C
SB	T6,FFFF (V0)
JR	RA
OR	V0,A0,R0

7F075AC8:	EXPAND INTO POINTERS

7F00B75C:	actual use, but not used for display?
LW	T6,0008 (V1)	//T6=offset table address
ADDU	T7,T6,S1	//T7=address for particular offset
LW	A1,0000 (T7)	//A1=offset
BEQL	A1,R0,7F00B798	//if NULL, iterate
	ADDIU	S0,S0,0001
LHU	T8,0000 (A1)	//T8=type of table command
ANDI	T9,T8,00FF	//T9=only type flag
BNEL	S3,T9,7F00B798	//If command !=12 branch	(S3=12 - handle)
	ADDIU	S0,S0,0001	//S0++
JAL	7F06C79C	//processes type command
OR	A0,S2,R0	//A0=S2 (object table address ie. 8023C320)
SW	R0,0000 (V0)
LW	V1,0008 (S2)	//A1=object's header address
LH	A2,000C (V1)	//A2=#offsets
ADDIU	S0,S0,0001	//S0++
//7F00B798:
SLT	AT,S0,A2
BNEZ	AT,7F00B75C	//run through all offsets...
ADDIU	S1,S1,0004
LW	RA,0024 (SP)
LW	S0,0014 (SP)
LW	S1,0018 (SP)
LW	S2,001C (SP)
LW	S3,0020 (SP)
JR	RA
ADDIU	SP,SP,0028

[7F06C79C:]	process type of command at offset
ADDIU	SP,SP,FFE0
SW	RA,0014 (SP)
LHU	T6,0000 (A1)	//T6=type at offset address
OR	A2,R0,R0	//A2=0
LW	A3,0010 (A0)	//A3=0x10 in object entry list	(A0 looks into object list)
ANDI	T7,T6,00FF	//T7=only the type at offset
ADDIU	T8,T7,FFFF	//T8=T7-1
SLTIU	AT,T8,0018	//AT=1 if valid type
BEQ	AT,R0,7F06C840
SLL	T8,T8,0x2	//T8->offset
LUI	AT,8005
ADDU	AT,AT,T8	//AT+=offset
LW	T8,4AF8 (AT)	//T8=80054AF8
JR	T8
NOP

---------
7F00B808:	construct the folders - probably
		S2=0-3, depending on which iteration is in use
		however, this only occurs on 4-bond menu...
ADDIU	SP,SP,FFE0
SW	RA,001C (SP)
SW	S0,0018 (SP)
SW	A1,0024 (SP)
OR	S0,A0,R0
ADDIU	A1,R0,0008	//A1=8 Connery selected file pic
JAL	7F00B7C0
ADDIU	A2,R0,0001
OR	A0,S0,R0
ADDIU	A1,R0,0009	//A1=9 Dalton selected file pic
JAL	7F00B7C0
OR	A2,R0,R0
OR	A0,S0,R0
ADDIU	A1,R0,000A	//A1=A Moore selected file pic
JAL	7F00B7C0
OR	A2,R0,R0
OR	A0,S0,R0
ADDIU	A1,R0,000B	//A1=B Brosnan selected file pic
JAL	7F00B7C0
OR	A2,R0,R0
OR	A0,S0,R0
ADDIU	A1,R0,000F	//A1=F Connery 4-folder pic (move to 10)
JAL	7F00B7C0
ADDIU	A2,R0,0001
OR	A0,S0,R0
ADDIU	A1,R0,0010	//A1=10 Dalton 4-folder pic (move to 12)
JAL	7F00B7C0
OR	A2,R0,R0
OR	A0,S0,R0
ADDIU	A1,R0,0011	//A1=11 Moore 4-folder pic (move to F)
JAL	7F00B7C0
OR	A2,R0,R0
OR	A0,S0,R0
ADDIU	A1,R0,0012	//A1=12	Brosnan 4-folder pic (move to 11)
JAL	7F00B7C0
OR	A2,R0,R0
LW	RA,001C (SP)
LW	S0,0018 (SP)
ADDIU	SP,SP,0020
JR	RA
NOP


7F00B7C0:	used to resolve an image offset and assign it to an object instance
		A0=address of object instance
		A1=menu offset #
		A2= visible==1 ? yes:no
ADDIU	SP,SP,FFE8
SW	RA,0014 (SP)
SW	A2,0020 (SP)
LW	T6,0008 (A0)	//T6=handle to object header (A0=object instance data)
SLL	T8,A1,0x2	//T8=offset#->address offset
LW	T7,0008 (T6)	//T7=offsets in object data
ADDU	T9,T7,T8	//T9=address of specific offset
LW	A3,0000 (T9)	//A3=selected offset
BEQL	A3,R0,7F00B7FC	//skip if NULL
	LW	RA,0014 (SP)
JAL	7F06C79C	//process type of command at offset
OR	A1,A3,R0	//A1=8023 address from object instance data
LW	T0,0020 (SP)	//T0=ordering number set to block!
SW	T0,0000 (V0)	//T0->8023CAD0 (++ for rest)
LW	RA,0014 (SP)
//7F00B7FC:
ADDIU	SP,SP,0018
JR	RA
NOP


-------------Physical menu construction
(too lazy to type it all)
//7F00BD90:
LW	A0,0000 (S0)	//A0=current menu address
JAL	7F00B808	//assign the images... (this is the bugger!)
OR	A1,V0,R0
//7F00BD9C:
LW	A0,0000 (S0)	//A0=pointer to object instance (S0=2A95C[+=4])
ADDIU	A1,R0,000E	//A1=menu offset# (shadow beneath slot selection pic)
JAL	7F00B7C0	//load/select image to be used
ADDIU	A2,R0,0001	//A2=activate image
LW	A0,0000 (S0)	//
ADDIU	A1,R0,000D	//A1=menu offset# (main folder select screen)
JAL	7F00B7C0	//load/select image to be used
ADDIU	A2,R0,0001	//A2=activate image
LW	T8,0054 (SP)
ADDIU	S2,S2,0001
ADDIU	AT,R0,0004
ADDIU	T9,T8,000C
SW	T9,0054 (SP)
ADDIU	S0,S0,0004
BNE	S2,AT,7F00BCD0
ADDIU	S1,S1,000C
//7F00BDDC:
LUI	V0,8003
ADDIU	V0,V0,A8E8	//V0=8002A8E8
LW	A0,0000 (V0)	//A0=selected slot
ADDIU	AT,R0,0064
BLTZ	A0,7F00BE30	//selected slot = -1 when no slot yet selected
NOP
//7F00BDF4:
BNE	A0,AT,7F00BE04
LUI	T0,8003
LW	A0,A8EC (T0)	//A0=8002A8EC=???
SW	A0,0000 (V0)	//A0->selected slot #
//7F00BE04:
BLTZ	A0,7F00BE14
SLTI	AT,A0,0004
BNEZ	AT,7F00BE1C
NOP
//7F00BE14:
SW	R0,0000 (V0)
OR	A0,R0,R0
//7F00BE1C:
JAL	7F00BB68
NOP
ADDIU	S1,R0,FFFF
LUI	AT,8003
SW	S1,A8E8 (AT)
//7F00BE30:
LUI	T1,8003
LW	T1,A91C (T1)	//T1=8002A91C=??? - same as slot selected?
ADDIU	S1,R0,FFFF
OR	S2,R0,R0
BLTZ	T1,7F00BFEC
LUI	S0,8003
//more - 7F00BE48

------------------ selected folder construction
(too lazy to type it all)
//7F00D340
LUI	A0,8003
JAL	7F01EBC0	//DELETED ROUTINE - now does V0=0
LW	A0,A8E8 (A0)	//A0=selected folder#
LW	A0,0000 (S0)	//A0=object instance address
JAL	7F00B808	//that crazy image selector thingy
OR	A1,V0,R0
//7F00D358:	construct the folder on-screen
LW	A0,0000 (S0)	//A0=object instance address
OR	A1,R0,R0	//A1=menu offset # (tabs)
JAL	7F00B7C0	//apply
ADDIU	A2,R0,0001	//A2=1 (visible)
LW	A0,0000 (S0)	//A0=object instance address
ADDIU	A2,R0,0001	//A1=menu offset # (basic folder)
JAL	7F00B7C0	//apply
ADDIU	A2,R0,0001	//A2=1 (visible)
LW	A0,0000 (S0)	//A0=object instance address
ADDIU	A2,R0,0003	//A1=menu offset # (OHMSS)
JAL	7F00B7C0	//apply
ADDIU	A2,R0,0001	//A2=1 (visible)
LW	A0,0000 (S0)	//A0=object instance address
ADDIU	A2,R0,0007	//A1=menu offset # (shadow beneath character img)
JAL	7F00B7C0	//apply
ADDIU	A2,R0,0001	//A2=1 (visible)
LW	A0,0000 (S0)	//A0=object instance address
ADDIU	A2,R0,0002	//A1=menu offset # (FOR YOUR EYES ONLY)
JAL	7F00B7C0	//apply
ADDIU	A2,R0,0001	//A2=1 (visible)
LUI	S0,8007
LUI	AT,8003
ADDIU	S0,S0,9784	//S0=80069784=sram data?  can"t remember offhand
SW	R0,A8E4 (AT)	//0->8002A8E4

etc...

7F01EBC0:	DELETED ROUTINE - org. handled character image used
SW	A0,0000 (SP)	//nothing uses this
JR	RA
OR	V0,R0,R0	//fries the pointer
-----------------------

7F00B258:	routine that handles calling the GOLDENEYE logo (through -B304)
//7F00B294:
LUI	A2,8003
LUI	A3,0003
ORI	A3,A3,C000
LW	A2,A950 (A2)	//A2=8002A950=address logo loaded to
LW	A0,0CFC (V0)	//A0=(8003AF24) OBJ modifier address for header
LW	A1,0D00 (V0)	//A1=(8003AF28) OBJ modifier address for text eqv.
JAL	7F0764A4
SW	R0,0010 (SP)
//7F00B2B4:
LUI	A0,8004
JAL	7F075CF4
LW	A0,AF24 (A0)	//A0=8003AF24=address of header
LUI	A0,8004
JAL	7F06C094
LW	A0,AF24 (A)	//A0=8003AF24=address of header
LUI	V1,8003
ADDIU	V1,V1,A958
SW	V0,0000 (V1)	//V0->8002A958 (address of loaded compressed binary)
OR	A0,V0,R0	//A0=V0
JAL	7F06CE78
LUI	A1,3F80
LUI	A0,8003
LW	A0,A958 (A0)	//A0=8002A958= V0 from above
JAL	7F06CC0C
ADDIU	A1,SP,0024
LW	RA,001C (SP)
ADDIU	SP,SP,0030
JR	RA
NOP

----
7F00B8AC:	routine that loads the folders
ADDIU	SP,SP,FFC8
LUI	T6,8003
LW	T6,A95C (T6)	//T6=object instance table
SW	RA,0034 (SP)
SW	S2,0030 (SP)
SW	S1,002C (SP)
SW	S0,0028 (SP)
BNEZ	T6,7F00B974	//if T6=NULL, ditch
SDC1	F20,0020 (SP)
LUI	S2,8004
ADDIU	S2,S2,A228	//S2=8003A228 (start of OBJ modifier table - objectified.xls)
LUI	A2,8003
LW	A2,A950 (A2)	//A2=8003A950=address for decompressed walletbond
LW	A0,0D08 (S2)	//A0=8003AF30=address for OBJ header
LW	A1,0D0C (S2)	//A1=8003AF34=address for OBJ name
ORI	A3,R0,A000	//A3=0000A000
JAL	7F0764A4	//DECOMPRESSES or at least copies OBJ to new location.  expands offsets
SW	R0,0010 (SP)
JAL	7F075CF4
LW	A0,0D08 (S2)	//A0=8003AF30=address for OBJ header

the file is parsed and expanded within 7F0764A4...  possibly right after writting the header though!

(after loading/copying file - FILE NOT YET EXPANDED!)
//7F0764E8:	fill OBJ header
OR	A2,V0,R0	//A2=V0=address of decompressed binary (8016C7D0)	ABOVE LINE IS SKIPPED BY SOME CODE!
LH	T9,0016 (S0)	//T9=# images declared
LH	T7,000C (S0)	//T7=# offsets
SW	A2,0008 (S0)	//address for offsets -> header+8
SLL	T0,T9,0x2
SUBU	T0,T0,T9	//T0=#imgs * 3
SLL	T8,T7,0x2	//T8=#off to offset
ADDU	V0,A2,T8	//V0=address for start of image declarations
SLL	T0,T0,0x2	//T0=(#imgs * 3) to offset
ADDU	T1,V0,T0	//T1=address for object table
SW	V0,0018 (S0)	//address for imgs -> header+18
SW	T1,0000 (S0)	//address for table -> header+0
OR	A0,S0,R0	//A0=S0=header address
JAL	7F075A90	//Expand + Parse object!
LUI	A1,0500

------------------------------------
------------------------------------
jump out @ 7F0764E8 to 8040something
AB018 -> AAB30, offset 4E8
do this:	70400070

simpler...
OR	T7,R0,RA
ORI	A2,R0,0A2E
JAL	subroutine
ADDIU	T0,V0,55AE
JAL	subroutine
ADDIU	T0,V0,550E
JAL	subroutine
ADDIU	T0,V0,56EE
OR	RA,R0,T7
J	7F0764F0
OR	A2,V0,R0

subroutine:	//8040009C
SH	A2,0000 (T0)
SH	A2,0F48 (T0)
ADDIU	A2,A2,0001
SH	A2,0038 (T0)
SH	A2,0F80 (T0)
ADDIU	A2,A2,0001
SH	A2,0048 (T0)
SH	A2,0F90 (T0)
ADDIU	A2,A2,0001
SH	A2,0058 (T0)
SH	A2,0FA0 (T0)
JR	RA
ADDIU	A2,A2,0001

81400070 001F
81400072 7825
81400074 3406
81400076 0A2E
81400078 0C10
8140007A 0027
8140007C 2448
8140007E 55AE
81400080 0C10
81400082 0027
81400084 2448
81400086 550E
81400088 0C10
8140008A 0027
8140008C 2448
8140008E 56EE
81400090 000F
81400092 F825
81400094 0FC1
81400096 D93C
81400098 0002
8140009A 3025

8140009C A506
8140009E 0000
814000A0 A506
814000A2 0F48
814000A4 24C6
814000A6 0001
814000A8 A506
814000AA 0038
814000AC A506
814000AE 0F80
814000B0 24C6
814000B2 0001
814000B4 A506
814000B6 0048
814000B8 A506
814000BA 0F90
814000BC 24C6
814000BE 0001
814000C0 A506
814000C2 0058
814000C4 A506
814000C6 0FA0
814000C8 03E0
814000CA 0008
814000CC 24C6
814000CE 0001


-----------------------
-----------------------
upload:

need to test two chunks:
ROM	actual	offset	value
3EB30	40354	1824	2A460004
	40364	1834	2A460003
	40374	1844	2A460002
	40384	1854	2A460001
	40394	1864	2A460004
	403A4	1874	2A460003
	403B4	1884	2A460002
	403C4	1894	2A460001
40B30	41E79	1349	92

then set the new image offsets in compressed binary...

-
8100D058	LUI V0,8040	->codeaddy
8100D05C	JALR V0,S1	->to newcode
8100D060	LUI S0,B004

ADDIU	V0,S0,0B30
BNE	V0,T3, +lower (3)
ADDIU	V0,S0,EB30

//upper:
ORI	S0,R0,0092
SB	S0,1349 (A2)

//lower:
BNE	V0,T3,+last (E)
LUI	V0,B00B
LUI	S0,2A46
ADDIU	S0,S0,0001
SW	S0,1854 (A2)
SW	S0,1894 (A2)
ADDIU	S0,S0,0001
SW	S0,1844 (A2)
SW	S0,1884 (A2)
ADDIU	S0,S0,0001
SW	S0,1834 (A2)
SW	S0,1874 (A2)
ADDIU	S0,S0,0001
SW	S0,1824 (A2)
SW	S0,1864 (A2)

//last:
ADDIU	V0,V0,AB30
BNE	V0,T3,+return (3)
LUI	S0,0810
ADDIU	S0,S0,001C	//lower half of jump 70400070
SW	S0,04E8 (A2)

//return:
LW	RA,001C (SP)
LW	S0,0014 (SP)
J	7000D060
OR	V0,R0,R0

8100D058 3C02
8100D05A 8040
8100D05C 0040
8100D05E 8809
8100D060 3C10
8100D062 B004

81400000 2602
81400002 0B30
81400004 144B
81400006 0003
81400008 2602
8140000A EB30
8140000C 3410
8140000E 0092
81400010 A0D0
81400012 1349
81400014 144B
81400016 000E
81400018 3C02
8140001A B00B
8140001C 3C10
8140001E 2A46
81400020 2610
81400022 0001
81400024 ACD0
81400026 1854
81400028 ACD0
8140002A 1894
8140002C 2610
8140002E 0001
81400030 ACD0
81400032 1844
81400034 ACD0
81400036 1884
81400038 2610
8140003A 0001
8140003C ACD0
8140003E 1834
81400040 ACD0
81400042 1874
81400044 2610
81400046 0001
81400048 ACD0
8140004A 1824
8140004C ACD0
8140004E 1864
81400050 2442
81400052 AB30
81400054 144B
81400056 0003
81400058 3C10
8140005A 0810
8140005C 2610
8140005E 001C
81400060 ACD0
81400062 04E8
81400064 8FBF
81400066 001C
81400068 8FB0
8140006A 0014
8140006C 0220
8140006E 0008
81400070 0000
81400072 1025
